package com.flyoil.petromp.mvp_p.MessagePresenter;

import com.flyoil.petromp.entity.entity_order.MapListEntity;
import com.flyoil.petromp.base.BaseModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.CoursePlanServiceDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.GoodsApproveDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.GoodsDemandDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.GoodsExamineDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.GoodsOrderDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.CoursePlanDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.ServiceApproveDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.ServiceDemandDetailModel;
import com.flyoil.petromp.mvp_m.CourseDetailModel.ServiceOrderDetailModel;
import com.flyoil.petromp.mvp_p.Listener.OrderGoodsMessageListener;
import com.flyoil.petromp.mvp_v.MessageUIView.OrderGoodsMessageUIView;
import com.flyoil.petromp.utils.OrderUtl.OrderListUtil;

import java.util.List;
import java.util.Map;

/**
 * Created by songzhiyin on 2017/11/2.
 * 单据明细详情界面逻辑逻辑类
 */

public class OrderGoodsMessagePresenter implements OrderGoodsMessageListener {
    private OrderGoodsMessageUIView view;
    private String order_type;
    private BaseModel model;

    public OrderGoodsMessagePresenter(OrderGoodsMessageUIView view, String order_type) {
        this.view = view;
        this.order_type = order_type;
        initModel();
    }

    @Override
    public void onsucced(List data) {
        view.updataToUI(null);
    }

    @Override
    public void initNetworkData(Map<String, Object> map) {
        model.loadNetworkData(map, this);
    }

    @Override
    public void upDataTextsView(List data) {
        view.upDataTextsView(data);
    }

    @Override
    public void upDataImgsView(String name, List data) {
        view.upDataImgsView(name, data);
    }

    @Override
    public void upDataRemarkView(MapListEntity entity) {
        view.upDataRemarkView(entity);
    }

    /**
     * 初始化model
     */
    private void initModel() {
        model = new CoursePlanDetailModel();
        switch (order_type) {
            case OrderListUtil.PLAN:
                model = new CoursePlanDetailModel();
                break;
            case "物资采购计划单服务明细":
                model = new CoursePlanServiceDetailModel();
                break;
            case OrderListUtil.GOODS_DEMAND:
                model = new GoodsDemandDetailModel();
                break;
            case OrderListUtil.GOODS_APPROVE:
                model = new GoodsApproveDetailModel();
                break;
            case OrderListUtil.GOODS_ORDER:
                model = new GoodsOrderDetailModel();
                break;
            case OrderListUtil.GOODS_EXAMINE:
                model = new GoodsExamineDetailModel();
                break;
            case OrderListUtil.GOODS_DATE_EXAMINE:
                break;
            case OrderListUtil.SERVICE_DEMAND:
                model = new ServiceDemandDetailModel();
                break;
            case OrderListUtil.SERVICE_APPROVE:
                model = new ServiceApproveDetailModel();
                break;
            case OrderListUtil.SERVICE_ORDER:
                model = new ServiceOrderDetailModel();
                break;
            case OrderListUtil.SERVICE_EXAMINE:
                break;
            case OrderListUtil.FINANCE:
                break;
        }
    }
}
